<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <p>我是b</p>
    <button>返回上一页浏览记录</button>
    <button>去C</button>
    <button>去下一个浏览记录</button>

    <script>
      var btn1 = document.querySelectorAll("button")[0];
      var btn2 = document.querySelectorAll("button")[1];
      var btn3 = document.querySelectorAll("button")[2];
      btn1.onclick = function () {
        window.history.back();
      };
      btn2.onclick = function () {
        window.location.href = "c.html";
      };
      btn3.onclick = function () {
        window.history.forward();
      };
    </script>
  </body>
</html>
